from rest_framework import serializers
from .models import Area
#1,上级行政区域信息
class AreaInfoSerializer(serializers.ModelSerializer):
    class Meta:
        model = Area
        fields = ("id","name")

#2,子级的行政区域信息
class AreaSubsInfoSerializer(serializers.ModelSerializer):
    subs = AreaInfoSerializer(read_only=True,many=True)
    class Meta:
        model = Area
        fields = ("id","name","subs")
